home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / orbit-1.0 / orbit-idl2.h
Encoding:
C/C++ Source or Header  |  2005-10-20  |  5.4 KB  |  173 lines

  1. #ifndef ORBIT_IDL2_H
  2. #define ORBIT_IDL2_H 1
  3.  
  4. #include <errno.h>
  5. #include <unistd.h>
  6. #include <stdio.h>
  7. #include <libIDL/IDL.h>
  8. #include <ORBitutil/basic_types.h>
  9. #define _ORBIT_H_    /* kludge - we only want ORBIT_SERIAL */
  10. #include <orb/orbit.h>
  11.  
  12. typedef struct {
  13.   char *cpp_args;
  14.   int debug_level;
  15.  
  16.   enum { OUTPUT_STUBS=1<<0,
  17.      OUTPUT_SKELS=1<<1,
  18.      OUTPUT_COMMON=1<<2,
  19.      OUTPUT_HEADERS=1<<3,
  20.      OUTPUT_SKELIMPL=1<<4 } enabled_passes;
  21.  
  22.   char *output_formatter;
  23.  
  24.   char *output_language;
  25.   char *input_filename;
  26.   char *backend_directory;
  27. } OIDL_Run_Info;
  28.  
  29. int orbit_idl_to_backend(const char *filename, OIDL_Run_Info *rinfo);
  30.  
  31. typedef struct {
  32.   IDL_tree tree;
  33. } OIDL_Output_Tree;
  34.  
  35. /* yadda yadda:
  36.    Fixed length as in bulk-marshallable
  37.    Fixed length as in a terminal allocation.
  38.  
  39.    Turn an IDL_LIST of params into a tree of marshalling info.
  40.      Each node will need to give:
  41.          Type (datum, loop, switch, string, complex)
  42.      Name
  43.      Subnodes (loop & switch only)
  44.      Dependencies
  45.  
  46.    Note for string_info.length_var, loop_info.loop_var, switch_info.discrim - these are all subnodes of the current node,
  47.    not pointers to other unrelated nodes.
  48.  
  49.    dependencies is a list of pointers to unrelated nodes.
  50.  */
  51. typedef struct _OIDL_Marshal_Node OIDL_Marshal_Node;
  52.  
  53. typedef enum { MARSHAL_DATUM = 0,
  54.            MARSHAL_LOOP = 1,
  55.            MARSHAL_SWITCH = 2,
  56.            MARSHAL_CASE = 3,
  57.            MARSHAL_COMPLEX = 4,
  58.            MARSHAL_CONST = 5,
  59.            MARSHAL_SET = 6
  60. } OIDL_Marshal_Node_Type;
  61.  
  62. typedef enum {
  63.   MN_INOUT = 1<<0, /* Needs freeing before alloc */
  64.   MN_NSROOT = 1<<1, /* Don't go to parents for variable naming */
  65.   MN_NEED_TMPVAR = 1<<2, /* Need a temporary variable to hold this value */
  66.   MN_NOMARSHAL = 1<<3, /* This is used by other vars, but not actually marshalled */
  67.   MN_ISSEQ = 1<<4, /* for MARSHAL_LOOP only - we need to do foo._buffer before tacking on [v1] */
  68.   MN_ISSTRING = 1<<5, /* for MARSHAL_LOOP only */
  69.   MN_LOOPED = 1<<6, /* This variable is looped over */
  70.   MN_COALESCABLE = 1<<7, /* You can coalesce multiple sequential instances of this type into one encode/decode operation */
  71.   MN_ENDIAN_DEPENDANT = 1<<8,
  72.   MN_DEMARSHAL_UPDATE_AFTER = 1<<9,
  73.   MN_DEMARSHAL_CORBA_ALLOC = 1<<10, /* Set if we can never allocate this thingie on the stack (i.e. an inout param) */
  74.   MN_DEMARSHAL_USER_MOD = 1<<11 /* OK, so this is just a hack to fix usage of the above flag */
  75. } OIDL_Marshal_Node_Flags;
  76.  
  77. struct _OIDL_Marshal_Node {
  78.   OIDL_Marshal_Node *up;
  79.   char *name;
  80.   IDL_tree tree;
  81.   OIDL_Marshal_Node_Type type;
  82.   GSList *dependencies;
  83.   union {
  84.     struct {
  85.       OIDL_Marshal_Node *loop_var, *length_var;
  86.       OIDL_Marshal_Node *contents;
  87.     } loop_info;
  88.     struct {
  89.       OIDL_Marshal_Node *discrim;
  90.       GSList *cases;
  91.     } switch_info;
  92.     struct {
  93.       GSList *labels;
  94.       OIDL_Marshal_Node *contents;
  95.     } case_info;
  96.     struct {
  97.       guint32 datum_size;
  98.     } datum_info;
  99.     struct {
  100.       OIDL_Marshal_Node *amount;
  101.     } update_info;
  102.     struct {
  103.       guint32 amount;
  104.     } const_info;
  105.     struct {
  106.       enum { CX_CORBA_FIXED, CX_CORBA_ANY, CX_CORBA_OBJECT, CX_CORBA_TYPECODE, CX_CORBA_CONTEXT } type;
  107.       int context_item_count;
  108.     } complex_info;
  109.     struct {
  110.       GSList *subnodes;
  111.     } set_info;
  112.   } u;
  113.   OIDL_Marshal_Node_Flags flags;
  114.   guint8 arch_head_align, arch_tail_align;
  115.   guint8 iiop_head_align, iiop_tail_align;
  116.   guint8 nptrs;
  117. };
  118.  
  119. /* Handling an IDLN_ATTR_DCL:
  120.    foreach(node->simple_declarations) {
  121.        turn node->data into a OIDL_Attr_Info.
  122.        Process op1 & op2.
  123.    }
  124. */
  125. typedef struct {
  126.   IDL_tree op1, op2;
  127. } OIDL_Attr_Info;
  128. typedef struct {
  129.   OIDL_Marshal_Node *in_stubs, *out_stubs, *in_skels, *out_skels;
  130.   int counter;
  131. } OIDL_Op_Info;
  132. typedef struct {
  133.   OIDL_Marshal_Node *marshal, *demarshal;
  134. } OIDL_Except_Info;
  135.  
  136. typedef struct {
  137.   const char *name;
  138.   void (*op_output)(OIDL_Output_Tree *tree, OIDL_Run_Info *rinfo);
  139. } OIDL_Backend_Info;
  140. OIDL_Backend_Info *orbit_idl_backend_for_lang(const char *lang,const char *backend_dir);
  141.  
  142. /* genmarshal */
  143. OIDL_Marshal_Node *orbit_idl_marshal_populate_in(IDL_tree tree, gboolean is_skels);
  144. OIDL_Marshal_Node *orbit_idl_marshal_populate_out(IDL_tree tree, gboolean is_skels);
  145. OIDL_Marshal_Node *orbit_idl_marshal_populate_except_marshal(IDL_tree tree);
  146. OIDL_Marshal_Node *orbit_idl_marshal_populate_except_demarshal(IDL_tree tree);
  147. char *oidl_marshal_node_fqn(OIDL_Marshal_Node *node);
  148. char *oidl_marshal_node_valuestr(OIDL_Marshal_Node *node);
  149.  
  150. /* passes */
  151. void orbit_idl_do_passes(IDL_tree tree, OIDL_Run_Info *rinfo);
  152.  
  153. /* Utils */
  154. void orbit_idl_attr_fake_ops(IDL_tree attr, IDL_ns ns);
  155. void oidl_marshal_tree_dump(IDL_tree tree, int indent_level);
  156. void oidl_marshal_node_dump(OIDL_Marshal_Node *tree, int indent_level);
  157. void orbit_idl_print_node(IDL_tree node, int indent_level);
  158. IDL_tree orbit_idl_get_array_type(IDL_tree tree);
  159. char *orbit_idl_member_get_name(IDL_tree tree);
  160. void orbit_idl_node_foreach(OIDL_Marshal_Node *node, GFunc func, gpointer user_data);
  161. void IDL_tree_traverse_parents(IDL_tree p, GFunc f, gconstpointer func_data);
  162. gboolean orbit_cbe_type_contains_complex(IDL_tree ts);
  163.  
  164. typedef enum { DATA_IN=1, DATA_INOUT=2, DATA_OUT=4, DATA_RETURN=8 } IDL_ParamRole;
  165. gint oidl_param_numptrs(IDL_tree param, IDL_ParamRole role);
  166. gboolean orbit_cbe_type_is_fixed_length(IDL_tree ts);
  167. IDL_tree orbit_cbe_get_typespec(IDL_tree node);
  168. IDL_ParamRole oidl_attr_to_paramrole(enum IDL_param_attr attr);
  169.  
  170. #define ORBIT_RETVAL_VAR_NAME "_ORBIT_retval"
  171.  
  172. #endif /* ORBIT_IDL2_H */
  173.